<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
    />
    <meta name="author" content="林镭特" />
    <title></title>
    <!-- <link href="../bootstrap/css/bootstrap.css" rel="stylesheet" /> -->
    <style>
      .center {
        width: 400px;
        margin: 0 auto;
      }
      #time {
        font-family: Digital Dismay;
        font-size: 80px;
      }
      .date {
        display: flex;
        justify-content: flex-end;
      }
    </style>
  </head>
  <body>
    <!-- 4，电子表。 -->
    <div class="center">
      <div id="time"></div>
      <div class="date">
        <div id="year"></div>
        <div id="week" style="padding-left: 15px;">星期一</div>
      </div>
    </div>

    <script>
      setInterval(fn, 1000);
      fn();
      function fn() {
        var now = new Date();
        var hour = add0(now.getHours());
        var min = add0(now.getMinutes());
        var second = add0(now.getSeconds());
        var year = now.getFullYear();
        var month = now.getMonth()+1;
        var dete = now.getDate();
        var week = now.getDay();

        function add0(num) {
          if (num < 10) {
            return "0" + num;
          } else {
            return num;
          }
        }
        switch (week) {
          case 1:
            week = "星期一";
            break;
          case 2:
            week = "星期二";
            break;
          case 3:
            week = "星期三";
            break;
          case 4:
            week = "星期四";
            break;
          case 5:
            week = "星期五";
            break;
          case 6:
            week = "星期六";
            break;
          case 0:
            week = "星期天";
            break;
        }

        document.getElementById("time").innerHTML =
          hour + ":" + min + ":" + second;
        document.getElementById("year").innerHTML =
          year + "年" + month + "月" + dete + "日";
        document.getElementById("week").innerHTML = week;
      }
    </script>
    <!-- <script src="../bootstrap/js/jquery.js"></script>
    <script src="../bootstrap/js/bootstrap.js"></script> -->
  </body>
</html>
